import { RadioGroupProps } from 'ant-design-vue'

import { SelectOptions } from '@/components/HeaderSearch/index.vue'

export type TaskStatus = '' | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

export type TaskStatusItem = {
  status: TaskStatus
  name: string
  title: string
  isError: boolean
}

export const statusOptions: SelectOptions[] = [
  {
    label: '创建中',
    value: 0
  },
  {
    label: '创建失败',
    value: 1
  },
  {
    label: '评估中',
    value: 2
  },
  {
    label: '评估成功',
    value: 3
  },
  {
    label: '评估失败',
    value: 4
  },
  {
    label: '评估超时',
    value: 5
  },
  {
    label: '已停止',
    value: 6
  },
  {
    label: '启动中',
    value: 7
  }
]
// 0：创建中 1：创建失败 2：评估中 3：评估成功 4：评估失败 5：评估超时 6：已停止 7：启动中
export const taskStatusList: TaskStatusItem[] = [
  {
    status: 0,
    name: '创建中',
    title: '创建中',
    isError: false
  },
  {
    status: 1,
    name: '创建失败',
    title: '创建失败',
    isError: true
  },
  {
    status: 2,
    name: '评估中',
    title: '评估中',
    isError: false
  },
  {
    status: 3,
    name: '评估成功',
    title: '评估成功',
    isError: false
  },
  {
    status: 4,
    name: '评估失败',
    title: '评估失败',
    isError: true
  },
  {
    status: 5,
    name: '评估超时',
    title: '评估超时',
    isError: true
  },
  {
    status: 6,
    name: '已停止',
    title: '已停止',
    isError: false
  },
  {
    status: 7,
    name: '启动中..',
    title: '启动中',
    isError: false
  }
]

export const sourceOptions: SelectOptions[] = [
  {
    label: '用户上传',
    value: 0
  },
  {
    label: '公开模型发布',
    value: 1
  },
  {
    label: '自定义模型发布',
    value: 2
  },
  {
    label: '我的算法发布',
    value: 3
  },
  {
    label: '预置算法发布',
    value: 4
  }
]
export const getTaskStatusItem = (status: TaskStatus): TaskStatusItem => {
  return taskStatusList.find(item => item.status === status)!
}

export const getSourceItem = (value: TaskStatus): SelectOptions => {
  return sourceOptions.find(item => item.value === value)!
}

export const radioOptions: RadioGroupProps['options'] = [
  { label: '宽松', value: 'low' },
  { label: '默认', value: 'medium' },
  { label: '精准', value: 'high' }
]
export const taskTypeArr: SelectOptions[] = [
  { value: 0, label: '模型管理' },
  { value: 1, label: '我收藏的公开模型' }
]
